package com.financing.platform.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.financing.platform.dao.IOrderDao;
import com.financing.platform.dao.IOrderManagerUserDao;
import com.financing.platform.dto.OrderManagerUserDTO;
import com.financing.platform.dto.UserInfoDTO;
import com.financing.platform.service.IOrderManagerUserService;
import com.financing.platform.vo.OrderEmailVO;
import com.financing.platform.vo.OrderManagerUserVO;

@Service("orderManagerUserServiceImpl")
@Transactional
public class OrderManagerUserServiceImpl implements IOrderManagerUserService {

	@Autowired
	private IOrderManagerUserDao orderManagerUserDaoImpl;
	
	@Autowired
	private IOrderDao orderDaoImpl;

	@Override
	public int addOrderManagerUser(OrderManagerUserDTO user) throws SQLException {
		return orderManagerUserDaoImpl.addOrderManagerUser(user);
	}

	@Override
	public int deleteOrderManagerUser(OrderManagerUserVO user) throws SQLException {
		return orderManagerUserDaoImpl.deleteOrderManagerUser(user);
	}

	@Override
	public List<OrderManagerUserVO> queryOrderManagerUsers(OrderManagerUserVO user) throws SQLException {
		return orderManagerUserDaoImpl.queryOrderManagerUsers(user);
	}

	@Override
	public int queryOrderManagerUsersCount(OrderManagerUserVO user) throws SQLException {
		return orderManagerUserDaoImpl.queryOrderManagerUsersCount(user);
	}

	@Override
	public List<OrderManagerUserVO> queryNotOrderManagerUsers(OrderManagerUserVO user) throws SQLException {
		return orderManagerUserDaoImpl.queryNotOrderManagerUsers(user);
	}
	
	@Override
	public int queryNotOrderManagerUsersCount(OrderManagerUserVO user) throws SQLException{
		return orderManagerUserDaoImpl.queryNotOrderManagerUsersCount(user);
	}

	@Override
	public List<OrderEmailVO> queryUserNeedTODOOrder(UserInfoDTO user)
			throws SQLException {
		List<OrderEmailVO> list = orderDaoImpl.queryneedSendEmailToManagerUserDetail(user);
		if(list != null){
			list.addAll(orderDaoImpl.queryneedSendEmailToManagerUserDetailSM(user));
		}
		return list;
	}
}
